From 2bf9a5bd290b75ff97695fd6f8304621d500d477 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Tue, 18 Feb 2020 09:42:29 +0100 Subject: [PATCH] aboutdialog: Replace visited_links GList with GPtrArray --- gtk/gtkaboutdialog.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gtk/gtkaboutdialog.c b/gtk/gtkaboutdialog.c index 65e174e849..6c1475f1cc 100644 --- a/gtk/gtkaboutdialog.c +++ b/gtk/gtkaboutdialog.c @@ -199,7 +199,7 @@ typedef struct GtkWidget *license_view; GtkWidget *system_view; - GSList *visited_links; + GPtrArray *visited_links; GtkLicense license_type; @@ -773,6 +773,8 @@ gtk_about_dialog_init (GtkAboutDialog *about) priv->license_type = GTK_LICENSE_UNKNOWN; + priv->visited_links = g_ptr_array_new_with_free_func (g_free); + gtk_dialog_set_default_response (GTK_DIALOG (about), GTK_RESPONSE_CANCEL); gtk_widget_init_template (GTK_WIDGET (about)); @@ -818,7 +820,7 @@ gtk_about_dialog_finalize (GObject *object) g_strfreev (priv->artists); g_slist_free_full (priv->credit_sections, destroy_credit_section); - g_slist_free_full (priv->visited_links, g_free); + g_ptr_array_unref (priv->visited_links); G_OBJECT_CLASS (gtk_about_dialog_parent_class)->finalize (object); } @@ -1881,7 +1883,7 @@ follow_if_link (GtkAboutDialog *about, if (uri) emit_activate_link (about, uri); - if (uri && !g_slist_find_custom (priv->visited_links, uri, (GCompareFunc)strcmp)) + if (uri && !g_ptr_array_find_with_equal_func (priv->visited_links, uri, (GCompareFunc)strcmp, NULL)) { GdkRGBA visited_link_color; GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (about)); @@ -1892,7 +1894,7 @@ follow_if_link (GtkAboutDialog *about, g_object_set (G_OBJECT (tag), "foreground-rgba", &visited_link_color, NULL); - priv->visited_links = g_slist_prepend (priv->visited_links, g_strdup (uri)); + g_ptr_array_add (priv->visited_links, g_strdup (uri)); } } @@ -2094,7 +2096,7 @@ text_buffer_new (GtkAboutDialog *about, link = g_strndup (q1, q2 - q1); - if (g_slist_find_custom (priv->visited_links, link, (GCompareFunc)strcmp)) + if (g_ptr_array_find_with_equal_func (priv->visited_links, link, (GCompareFunc)strcmp, NULL)) color = visited_link_color; else color = link_color; -- 2.30.2